from rest_framework.viewsets import ModelViewSet
from rest_framework.generics import ListAPIView

from meiduo_admin.serializers.pictureSerializer import PictureManageSerializer
from goods.models import SKUImage, SKU
from meiduo_admin.utils import PaginatorShow
from meiduo_admin.serializers.skuSerializer import SKUSerializer
from meiduo_admin.permissions import *


class PictureManageView(ModelViewSet):
    queryset = SKUImage.objects.all().order_by("id")
    serializer_class = PictureManageSerializer
    permission_classes = [IsAdminUser]

    pagination_class = PaginatorShow


class SKUSimpleView(ListAPIView):
    queryset = SKU.objects.all()
    serializer_class = SKUSerializer
    permission_classes = [IsAdminUser]